Imports OMANE.Common.UI
Imports System.Collections.ObjectModel
Imports System.Windows
Imports Infragistics.Windows.Chart
Imports System.Windows.Controls
Imports System.ComponentModel
Imports PTIC_GestionBDD
Imports System.Collections.Specialized
Imports Microsoft.Practices.Prism.Commands


''' <summary>
''' 
''' </summary>
''' <remarks></remarks>
Public Class ZoneType
    Inherits ViewModelBase

    Private _t As Type
    Private _attr As EditableZoneAttribute
    Private _Name As String

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="t"></param>
    ''' <remarks></remarks>
    Sub New(ByVal type As Type, ByVal attr As EditableZoneAttribute)
        _t = type
        _attr = attr
        _Name = type.Namespace & "." & type.Name
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Name As String
        Get
            Return _Name
        End Get
        Set(ByVal value As String)
            OnPropertyChanging("Name")
            _Name = value
            OnPropertyChanged("Name")
        End Set
    End Property

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property MainCategory As String
        Get
            Return _attr.MainCategory
        End Get
    End Property

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property SpecCategory As String
        Get
            Return _attr.SpecCategory
        End Get
    End Property

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Icone As String
        Get
            Return _attr.Icone
        End Get
    End Property

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Type As Type
        Get
            Return _t
        End Get
    End Property

    Public ReadOnly Property IsFacade As Boolean
        Get
            Return _attr.IsFacade

        End Get
    End Property

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Shared ReadOnly Property TypeComparer As IEqualityComparer(Of ZoneType)
        Get
            Return New TypeComparerClass()
        End Get
    End Property

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Private Class TypeComparerClass
        Implements IEqualityComparer(Of ZoneType)

        ''' <summary>
        ''' 
        ''' </summary>
        ''' <remarks></remarks>
        Private Function Equals1(ByVal x As ZoneType, ByVal y As ZoneType) As Boolean Implements System.Collections.Generic.IEqualityComparer(Of ZoneType).Equals
            Return x._t Is y._t
        End Function

        ''' <summary>
        ''' 
        ''' </summary>
        ''' <remarks></remarks>
        Private Function GetHashCode1(ByVal obj As ZoneType) As Integer Implements System.Collections.Generic.IEqualityComparer(Of ZoneType).GetHashCode
            Return obj._t.GetHashCode()
        End Function
    End Class

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Overrides Function ToString() As String
        Return _t.ToString()
    End Function
End Class
